import * as BaseApi from './BaseApi.js';


import * as Config from './Config.js';

export const queryCatTree = () => {
 
 let data = {
    userId: "web",
    token: "web111"
  }

  return BaseApi.requestForm(Config.g_service_url,'/category/querytree', data)
    .then(res => res)

}



export const addGoods = (model) => {
    
     return BaseApi.requestForm(Config.g_biz_url,'/goods/manager/add', model)
       .then(res => res)
   

  }
   

  export const updateGoods = (model) => {
    
     return BaseApi.requestForm(Config.g_biz_url,'/goods/manager/update', model)
       .then(res => res)
   
   
  }


  export const queryGoods = (self,params) => {
    params.token=self.$store.getters.getToken
    params.merchantId=self.$store.getters.getMerchantId
    params.onlineStatus=true
    
     return BaseApi.requestForm(Config.g_biz_url,'/goods/manager/query', params)
       .then(res => res)
   
   
  }
  export const queryGoodsDetail = (goodsId) => {

    let data={
      goodsId:goodsId
    }
    
    return BaseApi.requestGet(Config.g_biz_url,'/goods/detail', data)
       .then(res => res)
   
   
  }


  export const queryMemberPrice = (self,goodsId) => {
    
        let data={
          goodsId:goodsId,
          token: self.$store.getters.getToken,
          merchantId: self.$store.getters.getMerchantId
        }
        
        return BaseApi.requestForm(Config.g_biz_url,'/goods/memberprice/query', data)
           .then(res => res)
       
    }
    
  export const updateMemberPrice = (self,model) => {
            console.log(',,,',model)
            let data={
              token: self.$store.getters.getToken,
              merchantId: self.$store.getters.getMerchantId,
              memberPriceId:model.id,
              ownerPrice:model.ownerPrice,
              agentPrice:model.agentPrice,
              star3Price:model.star3Price,
              star4Price:model.star4Price,
              star5Price:model.star5Price
   
            }
            
            return BaseApi.requestForm(Config.g_biz_url,'/goods/memberprice/update', data)
               .then(res => res)
           
    }


  
  export const queryGoodsCarLink = (self,goodsId) => {
    
        let data={
          goodsId:goodsId,
          token: self.$store.getters.getToken,
          merchantId: self.$store.getters.getMerchantId
        }
        
        return BaseApi.requestForm(Config.g_biz_url,'/goods/car/linkquery', data)
           .then(res => res)
    }
 
 
        
     